<?php
class page extends CI_controller{

	function __construct(){
		parent::__construct();
		
		$this->load->helper('bara_helper');
		$this->load->library('bara_lib');
		
		$this->load->model('modul/model_page');
		
		$this->load->model('modul/model_menu');

		$this->load->model('modul/about_model');
		$this->load->model('modul/article_model');
		$this->load->model('modul/sosmed_model');
	}

	function view($id){

		$data['text_home'] = "Home";

		foreach ($this->model_page->get_page_view($this->bara_lib->language(),$id) as $key => $val) {
			$data['text_title'] = $val->judul_page;
		}

		$data['get_page_views'] = $this->model_page->get_page_view($this->bara_lib->language(),$id);

		$data['content'] = 'frontend/'. $this->bara_lib->theme() .'/page/view';

		//menu
		$data['get_menus'] = $this->model_menu->get_menu($this->bara_lib->language());

		// sosmed
		$data['gets_facebook'] = $this->sosmed_model->get_sosmed('facebook');
		$data['gets_twitter'] = $this->sosmed_model->get_sosmed('twitter');
		$data['gets_sosmed'] = $this->sosmed_model->get_sosmed_all();

		//footer
		$data['gets_about_footer'] = $this->about_model->get_about('about_us',$this->bara_lib->language());
		$data['get_articles_footer'] = $this->article_model->get_article($this->bara_lib->language(),3,0);
		//end footer

		$data['head'] = 'layout/'. $this->bara_lib->theme() .'/head';
		$data['menu'] = 'layout/'. $this->bara_lib->theme() .'/menu';
		$data['footer'] = 'layout/'. $this->bara_lib->theme() .'/footer';
		$this->load->view('layout/'. $this->bara_lib->theme() .'/inner', $data);	
	}

	function mod($set,$setw){

		$data['text_home'] = "Home";

		foreach ($this->model_page->get_page_mod($this->bara_lib->language(),$set,$setw) as $key => $val) {
			$data['text_title'] = $val->judul_setting_website;
		}

		$data['get_page_mods'] = $this->model_page->get_page_mod($this->bara_lib->language(),$set,$setw);

		$data['content'] = 'frontend/'. $this->bara_lib->theme() .'/page/mod';

		//menu
		$data['get_menus'] = $this->model_menu->get_menu($this->bara_lib->language());
		
		// sosmed
		$data['gets_facebook'] = $this->sosmed_model->get_sosmed('facebook');
		$data['gets_twitter'] = $this->sosmed_model->get_sosmed('twitter');
		$data['gets_sosmed'] = $this->sosmed_model->get_sosmed_all();
		
		//footer
		$data['gets_about_footer'] = $this->about_model->get_about('about_us',$this->bara_lib->language());
		$data['get_articles_footer'] = $this->article_model->get_article($this->bara_lib->language(),3,0);
		//end footer

		$data['head'] = 'layout/'. $this->bara_lib->theme() .'/head';
		$data['menu'] = 'layout/'. $this->bara_lib->theme() .'/menu';
		$data['footer'] = 'layout/'. $this->bara_lib->theme() .'/footer';
		$this->load->view('layout/'. $this->bara_lib->theme() .'/inner', $data);	
	}

}
?>